package cn.com.customer.manager.adapter

import android.widget.TextView
import cn.com.customer.manager.R
import cn.com.customer.manager.bean.Order
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder

class OrderListAdapter(rid: Int): BaseQuickAdapter<Order, BaseViewHolder>(rid) {
    override fun convert(helper: BaseViewHolder?, item: Order?) {
        if (item != null) {
            helper?.let {
//                it.setText(R.id.tv_order_name,item.oCustomerName)
//                it.setText(R.id.tv_order_num,item.oNum)
//                it.setText(R.id.tv_date_time,item.oEndTime)
//                it.setText(R.id.tv_date_time,item.oEndTime)
                val tv_order_status = helper.getView(R.id.tv_order_status) as TextView
                if(helper.adapterPosition==0){
                    tv_order_status.setTextColor(mContext.resources.getColor(R.color.colorPrimary))
                    tv_order_status.setBackgroundResource(R.drawable.shape_order_finish)
                    tv_order_status.text="订单完成"
                }else if(helper.adapterPosition==1){
                    tv_order_status.setTextColor(mContext.resources.getColor(R.color.order_ing))
                    tv_order_status.setBackgroundResource(R.drawable.shape_order_ing)
                    tv_order_status.text="订单进行中"
                }else{
                    tv_order_status.setTextColor(mContext.resources.getColor(R.color.order_error))
                    tv_order_status.setBackgroundResource(R.drawable.shape_order_error)
                    tv_order_status.text="订单异常"
                }
            }
        }
    }

}